//
//  JPAlertVC.m
//  Jpod
//
//  Created by zenox on 2021/10/25.
//

#import "JPAlertVC.h"


typedef enum : NSUInteger {
    JPAlertTypeSpecial = 0,
    JPAlertTypeCommon,
    JPAlertTypeAll
    
} JPAlertType;

@interface JPAlertVC ()<UITextViewDelegate>

@property (assign, nonatomic) JPAlertType alertType;


@property (weak, nonatomic)     UIView *maskBGView;
@property (weak, nonatomic)     UIView *backgroundView;
@property (nonatomic, strong) UIScrollView *backScrollView;
@property (nonatomic, assign) NSInteger currentIndex;

@property (weak, nonatomic)     UIImageView *titleBar;
@property (weak, nonatomic)     UIImageView *bottomBar;
@property (weak, nonatomic)     UIButton *dismissButton;

@property (nonatomic, strong) UIImageView *imgLimit;
@property (nonatomic, strong) UIImageView *imgNotice;
@property (nonatomic, strong) UIImageView *imgLine;

@property (weak, nonatomic)     UITextView *contentTextView;
@property (nonatomic, weak)     UIImageView *contentImageView;

@property (weak, nonatomic)     UIButton *noRemindButton;
@property (weak, nonatomic)     UILabel *noRemindLabel;

//@property (weak, nonatomic)     TYPageControl *pageControl;



@end

@implementation JPAlertVC


- (void)viewDidLoad {
    [super viewDidLoad];

    
    // Do any additional setup after loading the view.
}

- (void)setCurrentIndex:(NSInteger)currentIndex didClick:(BOOL)isClick{
    
    
    
}


- (void)setupUI{
    
    [self.maskBGView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.top.bottom.mas_equalTo(0);
    }];
    
    
}

#pragma mark --- Getter method ----

- (UIView *)maskBGView {
    
    if (!_maskBGView) {
        
        self.view.backgroundColor = [UIColor redColor];
        UIView *maskBGView = [[UIView alloc] init];
        maskBGView.backgroundColor = [UIColor blueColor];
        [self.view addSubview:maskBGView];
        
        UITapGestureRecognizer *ges = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(maskBackGroundDidClick)];
        [maskBGView addGestureRecognizer:ges];
        _maskBGView = maskBGView;
    }
    return _maskBGView;
}

- (UIView *)backgroundView {
    
    if (!_backgroundView) {
        UIView *backgroundView = [[UIView alloc] init];
        [self.view addSubview:backgroundView];
        backgroundView.backgroundColor = [UIColor redColor];
        backgroundView.layer.cornerRadius = 10.f;
        _backgroundView = backgroundView;
        _backgroundView.layer.shadowOpacity = 1.0;
        _backgroundView.layer.shadowOffset = CGSizeMake(0, 0);
        _backgroundView.layer.shadowRadius = 20;
    }
    return _backgroundView;
    
}

- (UIImageView *)titleBar {
    
    if (!_titleBar) {
        UIImageView *titleBar = [[UIImageView alloc] init];
        [self.backgroundView addSubview:titleBar];
        titleBar.image = [UIImage imageNamed:@"soom"];
        titleBar.userInteractionEnabled = YES;
        _titleBar = titleBar;
    }
    return _titleBar;
}
- (UIImageView *)bottomBar {
    
    if (!_bottomBar) {
        UIImageView *bottomBar = [[UIImageView alloc] init];
        [self.backgroundView addSubview:bottomBar];
        bottomBar.image = [UIImage imageNamed:@"soom"];
        bottomBar.userInteractionEnabled = YES;
        _bottomBar = bottomBar;
    }
    return _bottomBar;
}

- (UITextView *)contentTextView {
    if (!_contentTextView) {
        UITextView *contentTextView = [[UITextView alloc] init];
        [self.backScrollView addSubview:contentTextView];
        contentTextView.backgroundColor = [UIColor grayColor];
        contentTextView.editable = NO;
        contentTextView.bounces = NO;
        contentTextView.selectable = YES;
        contentTextView.delegate = self;
        _contentTextView = contentTextView;
        if (@available(iOS 11.0, *)) {
            _contentTextView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        }

    }
    return _contentTextView;
}

- (UIImageView *)contentImageView {

    if (!_contentImageView) {
        
        UIImageView *contentImageView = [[UIImageView alloc] init];
        
        /// 此处暂时设置为 Center，图片加载完成后会置为其他模式
        contentImageView.contentMode = UIViewContentModeCenter;
        contentImageView.userInteractionEnabled = YES;
        contentImageView.layer.masksToBounds = YES;
        contentImageView.backgroundColor = [UIColor yellowColor];
        UITapGestureRecognizer *ges = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(limitedNoticeDidClick)];
        [contentImageView addGestureRecognizer:ges];
        
        [self.backScrollView addSubview:contentImageView];
        _contentImageView = contentImageView;
    }
    return _contentImageView;
}

- (UIButton *)dismissButton {
    
    if (!_dismissButton) {
        UIButton *dismissButton = [[UIButton alloc] init];
        [dismissButton setImage:[UIImage imageNamed:@"soom"] forState:UIControlStateNormal];
        [dismissButton setImage:[UIImage imageNamed:@"soom"] forState:UIControlStateHighlighted];
        dismissButton.showsTouchWhenHighlighted = NO;
        [dismissButton addTarget:self action:@selector(dismissButtonDidClick) forControlEvents:UIControlEventTouchUpInside];
        [self.titleBar addSubview:dismissButton];
        _dismissButton = dismissButton;
    }
    return _dismissButton;
}

- (UIButton *)noRemindButton {
    
    if (!_noRemindButton) {
        UIButton *noRemindButton = [[UIButton alloc] init];
        [self.backgroundView addSubview:noRemindButton];
        [noRemindButton setImage:[UIImage imageNamed:@"soom"] forState:UIControlStateNormal];
        [noRemindButton setImage:[UIImage imageNamed:@"soom"] forState:UIControlStateHighlighted];
        [noRemindButton setImage:[UIImage imageNamed:@"soom"] forState:UIControlStateSelected];
        [noRemindButton setTintColor:[UIColor grayColor]];
        [noRemindButton setAdjustsImageWhenHighlighted:NO];
        [noRemindButton addTarget:self action:@selector(reminderButtonDidClick) forControlEvents:UIControlEventTouchUpInside];
        _noRemindButton = noRemindButton;
    }
    return _noRemindButton;
}

- (UILabel *)noRemindLabel {
    
    if (!_noRemindLabel) {
        UILabel *noRemindLabel = [[UILabel alloc] init];
        [self.backgroundView addSubview:noRemindLabel];
        noRemindLabel.text = @"今日不再提醒";
        noRemindLabel.font = [UIFont systemFontOfSize:14.f];
        noRemindLabel.textColor = [UIColor redColor];
        noRemindLabel.userInteractionEnabled  = YES;
        _noRemindLabel = noRemindLabel;
        
        UITapGestureRecognizer *ges = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(reminderButtonDidClick)];
        [noRemindLabel addGestureRecognizer:ges];
    }
    return _noRemindLabel;
}

- (void)maskBackGroundDidClick{
    
    
}
- (void)limitedNoticeDidClick{
    
    
}
- (void)reminderButtonDidClick{
    
}
- (void)dismissButtonDidClick{
    
}
/*
 sdsd sdasdfa
 */


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
